package com.zbkj.dal.base.enums;

import com.zbkj.dal.base.enums.show.EnumInterface;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@Getter
@AllArgsConstructor
public enum QualityEnum implements EnumInterface<String> {

    // 全新
    ENTIRELY_NEW("ENTIRELY_NEW", "全新"),
    // 九九新
    NINETY_NINE_NEW("NINETY_NINE_NEW", "99新"),
    // 九五新
    NINETY_FIVE_NEW("NINETY_FIVE_NEW", "95新"),
    // 九成新
    NINETY_NEW("NINETY_NEW", "9新"),
    // 八五新
    EIGHTY_FIVE_NEW("EIGHTY_FIVE_NEW", "85新");

    private final String code;

    private final String desc;

    @Override
    public String code() {
        return getCode();
    }

    @Override
    public String desc() {
        return getCode();
    }

    /**
     * 通过code，获取对应的desc
     */
    public static String getDescByCode(String code) {
        for (QualityEnum qualityEnum : QualityEnum.values()) {
            if (qualityEnum.getCode().equals(code)) {
                return qualityEnum.getDesc();
            }
        }
        return StringUtils.EMPTY;
    }
}
